import QtQuick 1.1
import com.meego 1.0
import "Component"

// 确认提示框
Item{

    id: container

    anchors.fill: parent

    property string diaTitle:  "提示"

    property string diaContent: "提示"

    property alias dialogStyle: myDialog.platformStyle

    signal accepted

    Dialog {
        id: myDialog
        width: parent.width; height: parent.height
        anchors.centerIn: parent
        title: Item {
            id: titleField
            height: myDialog.platformStyle.titleBarHeight
            width: parent.width
            Label {
                id: titleLabel
                anchors.left: parent.left
                anchors.verticalCenter: titleField.verticalCenter
                anchors.horizontalCenter: titleField.horizontalCenter
                font.pixelSize: 28
                color: "white"
                text: container.diaTitle
            }

            Image {
                id: closeButton
                anchors.verticalCenter: titleField.verticalCenter
                anchors.right: titleField.right

                source: "image://theme/icon-m-framework-close"

                MouseArea {
                    id: closeButtonArea
                    anchors.fill: parent
                    onClicked:  { myDialog.reject(); }
                }
            }
        }
        content: Item{
                width: myDialog.width - 30; height: 220
                Text {
                    id: text
                    anchors.centerIn: parent
                    font.pixelSize: 22
                    color: "white"
                    text: container.diaContent
                }
        }
        buttons: Row {
            spacing: 20
            anchors.horizontalCenter: parent.horizontalCenter


            Button {id: b1; width: 135; height: 60; platformStyle: CustomButtonStyle{} text: "确 定"; onClicked: myDialog.accept()}
            Button {id: b2; width: 135; height: 60; platformStyle: CustomButtonStyle{} text: "取 消"; onClicked: myDialog.close()}
        }

        onAccepted: {
            container.accepted();
        }
    }

    function open(){
        myDialog.open();
    }
}
